TreeGrid Drag Tutorial
3. Dragging external tag
Dragging from and to external sources
Drag grid cells here
Drag Gantt Run boxes here
Value A
Value B
Value C
Value D
Drag values to cells in grid
Row A
Row B
Row C
Row D
Drag rows as new children to grid
Box A
Box B
Box C
Box D
Drag run boxes into Gantt chart
-
TreeGrid provides also helping API methods for dragging anything to grid and also for dragging grid content outside grid.
-
Dragging cell outside grid
- Attach action
DragCell
to the event OnDragCell
for cell, column, row or for whole grid in <Actions> tag.
- Define API event OnStartDragCell if you want to conditionally suppress the dragging or change the object shown while dragging.
- Define API event OnMoveDragCell if you want to conditionally change mouse cursor during dragging.
- Define API event
OnEndDragCell
to provide the required action on drop the cell.
-
Dragging Gantt Run box outside grid
- Set Gantt cell or column attribute GanttRunMove to Move, Copy or Remove to let move run boxes outside the row. Optionally set it only for dragging with a key like Shift, Ctrl or Alt or by different mouse button.
- Define API event
OnGanttRunDrop
. It is called both during moving and also on drop. Provide here you custom action especially for drop.
-
Dragging external tags into grid
- Define onmousedown HTML event of the tag to be dragged. Return false from it to suppress selecting text. For IE define also onselectstart and return false to suppress selecting.
- In the onmousedown code you can call
DragByMouse
API function to attach some HTML to mouse to simulate the dragging.
- Define API event
OnMouseUp
to handle the dropping into grid. Here you can provide any action like changing the cell by SetString, adding new row by AddRow,
adding new Run box into Gantt chart by AddGanttRunBox, etc.